package com.cswangdao.mapper;

import com.cswangdao.domain.dto.CouponUserPageDTO;
import com.cswangdao.domain.model.MarketCouponUser;
import com.cswangdao.domain.vo.AvailableCouponVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MarketCouponUserMapper {

    Page<MarketCouponUser> pageQueryInfo(CouponUserPageDTO pageDTO);

    List<Integer> getCouponIdsByUserId(@Param("userId") Integer userId);

    MarketCouponUser getById(@Param("userCouponId") Integer userCouponId);

    @Delete("delete from market_coupon_user where id = #{userCouponId}")
    void deleteById(@Param("userCouponId") Integer userCouponId);

    MarketCouponUser getByUserIdAndCouponId(@Param("userId") int userId, @Param("couponId") Integer couponId);

    Integer getNumOfAvailableCoupon(@Param("userId") int userId, @Param("status") int status);

    List<MarketCouponUser> getCouponByUserId(@Param("userId") int userId);

    void addCouponUser(MarketCouponUser couponUser);

    void updateCouponUserById(MarketCouponUser couponUser);
}